$(function () {
    getUserList();
});

function getUserList(cunPage) {
    $.get("/tnweb/user/allUser/list", {
        "cunPage": cunPage
    }, function (data) {
        $("#list").html("");
        var allUserInfos = data.allUserInfos;
        var pageInfos = data.pageInfo;
        if (allUserInfos.length == 0) {
            $("#list").append("<div style='text-align: center;margin: 100px'>" +
                "<span>当前没有用户注册本站</span></div>")
            return;
        }
        cunPages = pageInfos.cunPage;
        lastPage = pageInfos.lastPage;
        $("#tipPage").text("共"+pageInfos.totalCount+"条"+pageInfos.lastPage+"页　当前为第"+ pageInfos.cunPage + "页")
        for (var i = 0; i < allUserInfos.length; i++) {
            var allUserInfo = allUserInfos[i];
            var userId = allUserInfo.userId;
            var headImg = allUserInfo.userHead;
            var userName = allUserInfo.userName;
            var userMcId = allUserInfo.userMcId;
            var userIsOnline = allUserInfo.userIsOnline;
            $("#list").append("<div style=\"height: 310px;width:307px;margin-bottom: 90px\">\n" +
                "                <div class=\"staff\" style=\"height: 310px\">\n" +
                "                    <div class=\"img-wrap d-flex align-items-stretch\" style=\"height: 200px;vertical-align: center\">\n" +
                "                        <!--<div class=\"img align-self-stretch\" style=\"background-image: url(images/teacher-1.jpg);\"></div>-->\n" +
                "                        <img class=\"img align-self-stretch\" src=\""+headImg+"\" alt=\"\" style=\"width: 200px;height: 200px;border-radius: 100px; margin-left: 54px\">\n" +
                "                    </div>\n" +
                "                    <div class=\"text pt-3 text-center\">\n" +
                "                        <h3>"+userName+"</h3>\n" +
                "                        <span class=\"mb-2\">"+userMcId+"</span>\n" +
                "                        <div class=\"faded\">\n" +
                "                            <p>"+userIsOnline+"</p>\n" +
                "                            <ul class=\"ftco-social text-center\">\n" +
                "                                <li><a href=\"/tnweb/user/otherPlayerInfo?id="+userId+"\"><span>点击查看他的信息~</span></a></li>\n" +
                "                            </ul>\n" +
                "                        </div>\n" +
                "                    </div>\n" +
                "                </div>\n" +
                "            </div>");

        }
    });
}

var cunPages;
var lastPage;

function getCunPages() {
    return cunPages;
}

function getLastPage() {
    return lastPage;
}